<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$this->addCssFile('/project/apps/ecga/styles/style.css');
$this->addCssFile('/project/apps/ecga/styles/layout.css');
$this->addCssFile('/project/apps/ecga/styles/form.css');
$this->addScriptFile('/statics/js/mootools/core.js');
?>

<body>
<div style=" background:#ffffff; width:100%; height:1000px; ">
    <?php //$this->import('tips'); ?>
    <div class="login-box">
        <div class="head"></div>
        <div class="body">
            <div style="/*display: block;*/ width:95%;" id="adviceMsg" class="<?php if (isset($warning))$this->put('validation-advice'); else $this->put('validation-cmpltn');?>">
                <?php if (isset($notice)):?>
                    <?php foreach($notice AS $n):?>
                        <?php $this->put($n);?>
                    <?php endforeach;?>
                <?php endif;?>
                <?php if (isset($warning)):?>
                    <?php foreach($warning AS $war):?>
                        <?php $this->put($war);?>
                    <?php endforeach;?>
                <?php endif;?>
            </div>
                <dt></dt>
                <dd>
                    <form id="theForm" method="post" action="profile.php?a=doLogin" target="_top">
                    <ul>
                        <li>
                            <p>邮件地址:</p>
                            <input type="text" style="width:130px" id="email" name="email" value="<?php $this->put($email); ?>" onchange="if(this.value.trim() != '')$('adviceMsg').innerHTML='';"/>
                        </li>
                        <li>
                            <p>密码:</p>
                            <input type="password" style="width:130px" id="password" name="password" onchange="if(this.value.trim() != '')$('adviceMsg').innerHTML='';"/>
                        </li>
                        <li>
                            <p>
                             <input type="submit" class="submit" value="登录" id="loginBtn"/>
                            </p>
                        </li>
                        <li>
                            <input type="checkbox" id="remember" name="remember"/><span>记住我</span>
                            <a href="#" id="findPassword">找回密码</a>
                        </li>
                    </ul>
                    </form>
                </dd>
        </div>
        <div class="bottom"></div>
        <?php $this->import('footer');?>
    </div>

<script type="text/javascript">
    window.addEvent("domready", function() {
        myFormValidator = new Form.Validator.Inline("theForm", {
            evaluateFieldsOnChange: false,
            evaluateFieldsOnBlur: false
        });

        if (Storage.read('loginEmail') && Storage.read('loginPwd')) {
            $('email').set('value', Storage.read('loginEmail'));
            $('password').set('value', Storage.read('loginPwd'));
            $('remember').set('checked', true);
        }

        new OverText($('captcha')).show();
        $('newCaptcha').addEvent('click', function(){
            $('captchaImg').src = "profile.php?a=captcha&" + Math.random();
        });
        var num = 1;
        $('captcha').addEvents({
            focus: function(){
                if ($("verification").isDisplayed()) return;
                $("verification").show().position({
                    relativeTo: this,
                    position: {x: "right", y: "top"},
                    offset: {y: -40}
                });

                if (1 == num) {
                    $('captchaImg').src = "profile.php?a=captcha&" + Math.random();
                }
                num = num + 1;
                var clickHanlder = function(event) {
                    var target = $(event.target);
                    if (!target.getParent("#verification") && target != $("verification") && target != $("captcha") && !target.hasClass("overTxtLabel")) {
                        $("verification").hide();
                        document.removeEvent("click", clickHanlder);
                    }
                }.create({event: true});
                document.addEvent("click", clickHanlder);
            }
        });

        $('theForm').addEvent('submit',function(){
            if ($('email').value.trim() == '') {
                $('adviceMsg').set('class', 'validation-advice');
                $('adviceMsg').innerHTML = '请输入用户名';
                return false;
            }
            if ($('password').value.trim() == '') {
                $('adviceMsg').set('class', 'validation-advice');
                $('adviceMsg').innerHTML = '请输入密码';
                return false;
            }
            if ($('remember').getProperty('checked')) {
                Storage.write('loginEmail',$('email').value.trim());
                Storage.write('loginPwd',$('password').value.trim());
            }
        });

        $('findPassword').addEvent('click', function(){
            $('findPassword').href = "profile.php?a=findPassword";
        });
    });
</script>
</div>
<p style="height:0; overflow:hidden; clear:both; font-size:0; "></p>
</body>
</html>
